package com.fadadianqi.logistics.admin.net.mina;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class NIOCodecFactory implements ProtocolCodecFactory {

    private Encoder encoder;
    private Decoder decoder;

    public NIOCodecFactory() {
        this.encoder = new Encoder();
        this.decoder = new Decoder();
    }

    @Override
    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return encoder;
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return decoder;
    }

}
